import React, {Component} from 'react';
import {Provider} from 'react-redux';
import {BrowserRouter, Route} from 'react-router-dom';
import {GlobalStyle} from './style.js';
import Header from './common/header';
import store from './store';

import Home from './pages/home';
import Detail from './pages/detail';

class App extends Component {
  render(){
    return (
        // Provider把store里的数据都提供给包裹在里面的组件
        <Provider store={store}>
            <BrowserRouter>
                <div>
                    <GlobalStyle />
                    <Header />
                    <Route path='/' exact component={Home} />
                    <Route path='/detail/:id' exact component={Detail} />
                </div>
            </BrowserRouter>
        </Provider>

    );
  }
}

export default App;
